# src/SConscript begin

Import("env")

# Common object files:
obj_chunk = env.Object("util/chunk.c")
obj_utf8 = env.Object("util/utf8.c")
obj_nfa = env.Object("util/nfa.c")
obj_misc = env.Object("util/misc.c")
obj_log = env.Object("util/log.c")
obj_re = env.Object("util/re.c")
obj_packrat = env.Object("util/packrat.c")
obj_lex = env.Object("util/lex.c")
obj_token = env.Object("util/token.c")
obj_map = env.Object("types/map.c")
obj_value = env.Object("types/value.c")
obj_hash = env.Object("util/hash.c")
obj_array = env.Object("types/array.c")
obj_vector = env.Object("util/vector.c")
obj_error = env.Object("util/error.c")

objects = [obj_chunk, obj_utf8, obj_nfa, obj_misc, obj_log, obj_re,
           obj_packrat, obj_lex, obj_token, obj_map, obj_value, obj_hash,
           obj_array, obj_vector, obj_error]

env.Program(target = "../ripescript",
            source = ["ripescript.c"] + objects,
            LIBS = ["gc"])

# Tests
env.Program(target = "test/utf8-decode/utf8-decode",
            source = ["test/utf8-decode/utf8-decode.c", obj_utf8],
            LIBS = ["gc"])

env.Program(target = "test/utf8-encode/utf8-encode",
            source = ["test/utf8-encode/utf8-encode.c", obj_utf8],
            LIBS = ["gc"])

env.Program(target = "test/nfa/nfa",
            source = ["test/nfa/nfa.c", obj_nfa, obj_chunk, obj_misc, obj_log,
                                        obj_vector],
            LIBS = ["gc"])

env.Program(target = "test/map/map",
            source = ["test/map/map.c", obj_map, obj_value, obj_hash],
            LIBS = ["gc"])

env.Program(target = "test/re/re",
            source = ["test/re/test_re.c"] + objects,
            LIBS = ["gc"])

env.Program(target = "test/lex/lex",
            source = ["test/lex/test_lex.c"] + objects,
            LIBS = ["gc"])

env.Program(target = "../ripeasm",
            source = ["assembler.c"] + objects,
            LIBS = ["gc"])

# src/SConscript end
